
package databaseapp;

import java.sql.*;
import javax.swing.JOptionPane;


public class DBConnect 
{
    Connection conn = null;
     public static Connection Ketnoi()
    {
        try{
            Class.forName("com.mysql.jdbc.Driver");
            String dbURL = "jdbc:mysql://localhost:3306/test";
            String username = "root";
            String password = "";
            Connection conn = DriverManager.getConnection(dbURL, username, password);
            //JOptionPane.showMessageDialog(null, "Ket noi thanh cong");
            return conn;
        }catch(Exception ex)
        {
            System.out.printf("Error" + ex);
            return null;
        }
       
    }
}
